package 小红的口罩;

import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        PriorityQueue<Integer> q = new PriorityQueue<>();
        int res = 0, cnt = 0;
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            q.offer(x);
        }
        while (true) {
            int t = q.poll();
            if (res + t > k) {
                break;
            }
            res += t;
            cnt++;
            q.offer(t * 2);
        }
        System.out.println(cnt);
    }
}
